Skip to content

fix(ai-sandbox): compare snapshot transcript by role and content - #1168

Merged
AlemTuzlak merged 2 commits into
mainfrom
fix/sandbox-snapshot-transcript
Aug 20, 2026
Merged

fix(ai-sandbox): compare snapshot transcript by role and content#1168
AlemTuzlak merged 2 commits into
mainfrom
fix/sandbox-snapshot-transcript

Conversation

@AlemTuzlak

@AlemTuzlak AlemTuzlak commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

After #1126, chat() stores the completed assistant turn with id and createdAt. The portable snapshot test compared the full message object, so @tanstack/ai-sandbox:test:lib failed on main.

This PR compares role and content only. The checkpoint still stores the extra fields.

🎯 Changes

The snapshot lifecycle test no longer requires the assistant message to have only role and content.

No docs update. This is a test assertion, not a user-facing change.
No changeset. Published packages did not change.

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm run test:pr.
  • Docs: I updated docs/ for this change, or this change is not user-facing.
  • Changeset: I added a changeset (pnpm changeset), or this PR does not change a published package.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

Testing

Commands run:

  1. pnpm --filter @tanstack/ai-persistence build
  2. pnpm --filter @tanstack/ai-sandbox build
  3. pnpm --filter @tanstack/ai-sandbox test:lib — 971 passed

Skipped pnpm test:pr (full affected CI set). The red job on main is only @tanstack/ai-sandbox:test:lib.

Manual test:

  1. On main, run pnpm --filter @tanstack/ai-sandbox test:lib
  2. See persists the completed transcript, files, and artifacts after completion fail because the assistant message has id and createdAt
  3. On this branch, run the same command
  4. The suite passes

How this PR makes testing easy: the failing unit test is the coverage. No extra command or example app change.

Risk / rollback

Low. One assertion. Revert the PR to undo.

Summary by CodeRabbit

  • Tests
    • Improved snapshot lifecycle validation by focusing transcript comparisons on message roles and content.
    • Reduced test brittleness from unrelated message metadata changes.

After persist-structured-output, chat stores assistant id and createdAt on the completed turn. The portable snapshot test compared the full message object, so main failed. Compare role and content only.
@coderabbitai

coderabbitai Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 4097c9dd-b3b4-4b2d-9cb5-6627106c7d84

📥 Commits

Reviewing files that changed from the base of the PR and between d8b3350 and f6e9581.

📒 Files selected for processing (1)
  • packages/ai-sandbox/tests/snapshot-lifecycle.test.ts

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The snapshot lifecycle test now compares checkpoint conversation messages using only their role and content fields.

Changes

Snapshot lifecycle assertions

Layer / File(s) Summary
Checkpoint message projection
packages/ai-sandbox/tests/snapshot-lifecycle.test.ts
The test projects checkpoint conversation messages to role and content before comparing the expected transcript.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Merge Risk: ⚪ Minimal · up to f6e95

This change only narrows the snapshot assertion to the assistant message role and content while preserving checkpoint fields; it does not alter published or runtime behavior, and no actionable merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main test assertion change.
Description check ✅ Passed The description covers the change, rationale, testing, checklist, release impact, and rollback plan.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/sandbox-snapshot-transcript

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nx-cloud

nx-cloud Bot commented Aug 20, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit f6e9581

Command Status Duration Result
nx run-many --targets=build --exclude=examples/... ✅ Succeeded 1s View ↗

☁️ Nx Cloud last updated this comment at 2026-08-20 14:45:37 UTC

@pkg-pr-new

pkg-pr-new Bot commented Aug 20, 2026

Copy link
Copy Markdown

Open in StackBlitz

@tanstack/ai

npm i https://pkg.pr.new/@tanstack/ai@1168

@tanstack/ai-acp

npm i https://pkg.pr.new/@tanstack/ai-acp@1168

@tanstack/ai-angular

npm i https://pkg.pr.new/@tanstack/ai-angular@1168

@tanstack/ai-anthropic

npm i https://pkg.pr.new/@tanstack/ai-anthropic@1168

@tanstack/ai-bedrock

npm i https://pkg.pr.new/@tanstack/ai-bedrock@1168

@tanstack/ai-byteplus

npm i https://pkg.pr.new/@tanstack/ai-byteplus@1168

@tanstack/ai-claude-code

npm i https://pkg.pr.new/@tanstack/ai-claude-code@1168

@tanstack/ai-client

npm i https://pkg.pr.new/@tanstack/ai-client@1168

@tanstack/ai-code-mode

npm i https://pkg.pr.new/@tanstack/ai-code-mode@1168

@tanstack/ai-code-mode-snippets

npm i https://pkg.pr.new/@tanstack/ai-code-mode-snippets@1168

@tanstack/ai-codex

npm i https://pkg.pr.new/@tanstack/ai-codex@1168

@tanstack/ai-cohere

npm i https://pkg.pr.new/@tanstack/ai-cohere@1168

@tanstack/ai-devtools-core

npm i https://pkg.pr.new/@tanstack/ai-devtools-core@1168

@tanstack/ai-durable-stream

npm i https://pkg.pr.new/@tanstack/ai-durable-stream@1168

@tanstack/ai-elevenlabs

npm i https://pkg.pr.new/@tanstack/ai-elevenlabs@1168

@tanstack/ai-event-client

npm i https://pkg.pr.new/@tanstack/ai-event-client@1168

@tanstack/ai-fal

npm i https://pkg.pr.new/@tanstack/ai-fal@1168

@tanstack/ai-gemini

npm i https://pkg.pr.new/@tanstack/ai-gemini@1168

@tanstack/ai-grok

npm i https://pkg.pr.new/@tanstack/ai-grok@1168

@tanstack/ai-grok-build

npm i https://pkg.pr.new/@tanstack/ai-grok-build@1168

@tanstack/ai-groq

npm i https://pkg.pr.new/@tanstack/ai-groq@1168

@tanstack/ai-isolate-cloudflare

npm i https://pkg.pr.new/@tanstack/ai-isolate-cloudflare@1168

@tanstack/ai-isolate-daytona

npm i https://pkg.pr.new/@tanstack/ai-isolate-daytona@1168

@tanstack/ai-isolate-node

npm i https://pkg.pr.new/@tanstack/ai-isolate-node@1168

@tanstack/ai-isolate-quickjs

npm i https://pkg.pr.new/@tanstack/ai-isolate-quickjs@1168

@tanstack/ai-isolate-quickjs-bun

npm i https://pkg.pr.new/@tanstack/ai-isolate-quickjs-bun@1168

@tanstack/ai-mcp

npm i https://pkg.pr.new/@tanstack/ai-mcp@1168

@tanstack/ai-memory

npm i https://pkg.pr.new/@tanstack/ai-memory@1168

@tanstack/ai-mistral

npm i https://pkg.pr.new/@tanstack/ai-mistral@1168

@tanstack/ai-ollama

npm i https://pkg.pr.new/@tanstack/ai-ollama@1168

@tanstack/ai-openai

npm i https://pkg.pr.new/@tanstack/ai-openai@1168

@tanstack/ai-opencode

npm i https://pkg.pr.new/@tanstack/ai-opencode@1168

@tanstack/ai-openrouter

npm i https://pkg.pr.new/@tanstack/ai-openrouter@1168

@tanstack/ai-perplexity

npm i https://pkg.pr.new/@tanstack/ai-perplexity@1168

@tanstack/ai-persistence

npm i https://pkg.pr.new/@tanstack/ai-persistence@1168

@tanstack/ai-preact

npm i https://pkg.pr.new/@tanstack/ai-preact@1168

@tanstack/ai-react

npm i https://pkg.pr.new/@tanstack/ai-react@1168

@tanstack/ai-react-ui

npm i https://pkg.pr.new/@tanstack/ai-react-ui@1168

@tanstack/ai-sandbox

npm i https://pkg.pr.new/@tanstack/ai-sandbox@1168

@tanstack/ai-sandbox-cloudflare

npm i https://pkg.pr.new/@tanstack/ai-sandbox-cloudflare@1168

@tanstack/ai-sandbox-daytona

npm i https://pkg.pr.new/@tanstack/ai-sandbox-daytona@1168

@tanstack/ai-sandbox-docker

npm i https://pkg.pr.new/@tanstack/ai-sandbox-docker@1168

@tanstack/ai-sandbox-local-process

npm i https://pkg.pr.new/@tanstack/ai-sandbox-local-process@1168

@tanstack/ai-sandbox-sprites

npm i https://pkg.pr.new/@tanstack/ai-sandbox-sprites@1168

@tanstack/ai-sandbox-vercel

npm i https://pkg.pr.new/@tanstack/ai-sandbox-vercel@1168

@tanstack/ai-solid

npm i https://pkg.pr.new/@tanstack/ai-solid@1168

@tanstack/ai-solid-ui

npm i https://pkg.pr.new/@tanstack/ai-solid-ui@1168

@tanstack/ai-svelte

npm i https://pkg.pr.new/@tanstack/ai-svelte@1168

@tanstack/ai-utils

npm i https://pkg.pr.new/@tanstack/ai-utils@1168

@tanstack/ai-vercel-gateway

npm i https://pkg.pr.new/@tanstack/ai-vercel-gateway@1168

@tanstack/ai-vue

npm i https://pkg.pr.new/@tanstack/ai-vue@1168

@tanstack/ai-vue-ui

npm i https://pkg.pr.new/@tanstack/ai-vue-ui@1168

@tanstack/openai-base

npm i https://pkg.pr.new/@tanstack/openai-base@1168

@tanstack/preact-ai-devtools

npm i https://pkg.pr.new/@tanstack/preact-ai-devtools@1168

@tanstack/react-ai-devtools

npm i https://pkg.pr.new/@tanstack/react-ai-devtools@1168

@tanstack/solid-ai-devtools

npm i https://pkg.pr.new/@tanstack/solid-ai-devtools@1168

commit: 9843cae

@AlemTuzlak
AlemTuzlak enabled auto-merge (squash) August 20, 2026 14:53
@AlemTuzlak
AlemTuzlak merged commit 22b5b7d into main Aug 20, 2026
9 checks passed
@AlemTuzlak
AlemTuzlak deleted the fix/sandbox-snapshot-transcript branch August 20, 2026 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant